﻿Imports Entities
Imports DataAccess
Public Class VillaBL
    Public Shared Function List() As List(Of VILLAS)
        Dim lista As New List(Of VILLAS)
        lista = VillaDAL.List
        If lista.Count > 0 Then
            Return lista
        Else
            Return Nothing
        End If
    End Function
    Public Shared Function Save(ByVal zObject As VILLAS) As Boolean
        If VillaDAL.Exist(zObject.VILLA) Then
            VillaDAL.Update(zObject)
            Return True
        Else
            Return VillaDAL.Create(zObject)
        End If
    End Function

    Public Shared Function Delete(ByVal zId As Long) As Boolean
        Return VillaDAL.Delete(zId)
    End Function

    Public Shared Function SearchById(ByVal zId As Long) As VILLAS
        Dim obj As New villas
        obj = villadal.SearchById(zId)
        If Not IsNothing(obj) Then
            Return obj
        Else
            Return Nothing
        End If
    End Function
      Public Shared Function GetNombre(ByVal zId As Long) As String
        Dim obj As New VILLAS
        obj = VillaDAL.SearchById(zId)
        If Not IsNothing(obj) Then
            Return obj.NOMBRE
        Else
            Return ""
        End If
    End Function
End Class
